:root {
  --primary-color: #4A90E2;
  --success-color: #6DD400;
  --danger-color: #FF5A5F;
  --text-primary: #2D3748;
  --text-secondary: #718096;
  --border-color: #E2E8F0;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.12);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: #F7FAFC;
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
}

.container {
  max-width: 1200px;
  margin: 2rem auto;
  padding: 0 1rem;
  height: calc(100vh - 4rem); /* 关键修改1：容器高度计算 */
}

.upload-card {
  background: white;
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  padding: 2.5rem;
  position: relative;
  height: 100%; /* 关键修改2：继承容器高度 */
  display: flex;
  flex-direction: column;
}

.help-icon {
  width: 24px;
  height: 24px;
  transition: all 0.2s;
}
/* 在原有.help-icon样式下方添加 */
.help-icon-wrapper {
  position: absolute;
  top: 2rem;
  right: 2rem;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.help-text {
  color: #f1a481;
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.2s;
}

.help-icon-wrapper:hover .help-icon,
.help-icon-wrapper:hover .help-text {
  color: #FFC107; /* 悬停时使用更亮的黄色 */
}

@media (max-width: 768px) {
  .help-icon-wrapper {
    top: 1.5rem;
    right: 1.5rem;
  }
  .help-text {
    display: none; /* 移动端隐藏文字 */
  }
}


.help-icon:hover {
  color: var(--primary-color);
  transform: scale(1.1);
}

.section-title {
  text-align: center;
  font-size: 1.8rem;
  margin-bottom: 2.5rem;
  position: relative;
  padding: 0 40px;
}

.section-title::after {
  content: '';
  width: 60px;
  height: 3px;
  background: var(--primary-color);
  position: absolute;
  bottom: -12px;
  left: 50%;
  transform: translateX(-50%);
}

.upload-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 3rem;
  margin-bottom: 2.5rem;
  flex: 1; /* 关键修改3：弹性布局填充剩余空间 */
  min-height: 400px; /* 保证最小高度 */
}

.upload-zone {
  position: relative;
  border: 2px dashed var(--border-color);
  border-radius: 8px;
  height: 55vh; /* 关键修改4：固定视口高度 */
  min-height: 350px;
  max-height: 600px;
  cursor: pointer;
  transition: all 0.3s ease;
  background: #F8FAFC;
  overflow: hidden;
}

.upload-zone:hover {
  border-color: var(--primary-color);
  background: rgba(74, 144, 226, 0.05);
}

.upload-zone.dragover {
  border-color: var(--success-color);
  background: rgba(109, 212, 0, 0.05);
}

.upload-icon-wrapper {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  z-index: 1;
  transition: opacity 0.3s;
}

.upload-icon {
  width: 60px;
  height: 60px;
  margin-bottom: 1rem;
  opacity: 0.8;
}

.preview-container {
  position: relative;
  width: 100%;
  height: 100%;
}

.preview-image {
  width: 100%;
  height: 100%;
  object-fit: contain; /* 关键修改5：保持图片完整显示 */
  display: none;
  position: relative;
  z-index: 2;
}

.file-info {
  position: absolute;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.9rem;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.9);
  padding: 0.5rem 1rem;
  border-radius: 4px;
  opacity: 0;
  transition: opacity 0.3s;
}

.upload-zone.has-file .upload-icon-wrapper {
  opacity: 0;
}

.upload-zone.has-file .file-info {
  opacity: 1;
}

.action-group {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  margin-top: auto; /* 关键修改6：按钮始终在底部 */
  padding-top: 2rem;
}

.btn {
  padding: 0.8rem 2rem;
  border: none;
  border-radius: 6px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-primary {
  background: var(--primary-color);
  color: white;
}

.btn-secondary {
  background: var(--danger-color);
  color: white;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.modal-content {
  background: white;
  padding: 2rem;
  border-radius: 12px;
  max-width: 500px;
  width: 90%;
  animation: modalSlide 0.3s ease-out;
}
/* 在原有.modal-content样式后添加 */
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.close-icon {
  width: 28px;
  height: 28px;
  cursor: pointer;
  padding: 4px;
  transition: all 0.2s;
  color: var(--text-secondary);
}

.close-icon:hover {
  color: var(--danger-color);
  transform: rotate(90deg);
}


@keyframes modalSlide {
  from { transform: translateY(-20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.rule-list {
  list-style: none;
  margin-bottom: 1.5rem;
}

.rule-item {
  margin-bottom: 1rem;
  padding-left: 2rem;
  position: relative;
  color: var(--text-secondary);
}

.rule-item::before {
  content: '✓';
  color: var(--success-color);
  position: absolute;
  left: 0;
  font-weight: bold;
}

.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--text-primary);
  color: white;
  padding: 1rem 2rem;
  border-radius: 8px;
  box-shadow: var(--shadow-md);
  display: none;
  animation: slideIn 0.3s ease-out;
}
/* 加载动画 */
.toast.processing {
  position: relative;
  padding-left: 3rem;
}

.toast.processing::before {
  content: "";
  position: absolute;
  left: 1rem;
  top: 50%;
  width: 1.5rem;
  height: 1.5rem;
  border: 3px solid rgba(255,255,255,0.3);
  border-radius: 50%;
  border-top-color: #fff;
  animation: spin 1s ease-in-out infinite;
}
.toast {
    /* 原有样式基础上添加 */
    min-width: 280px;
    padding: 1rem 2rem;
    background: rgba(0,0,0,0.9);
    color: white;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.toast::before {
    font-size: 1.2em;
}

/* 不同状态图标 */
.toast[class*="✅"]::before { content: "✅"; }
.toast[class*="❌"]::before { content: "❌"; }
.toast[class*="🔄"]::before { content: "🔄"; }
.toast[class*="📤"]::before { content: "📤"; }
.toast[class*="✔️"]::before { content: "✔️"; }

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes slideIn {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

@media (max-width: 768px) {
  .upload-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .upload-card {
    padding: 1.5rem;
  }

  .help-icon {
    top: 1.5rem;
    right: 1.5rem;
  }

  .upload-zone {
    height: 45vh; /* 移动端调整高度 */
    min-height: 300px;
  }
}

@media (max-height: 700px) {
  .container {
    height: calc(100vh - 2rem);
    margin: 1rem auto;
  }

  .upload-zone {
    height: 50vh;
    min-height: 280px;
  }

  .section-title {
    margin-bottom: 1.5rem;
  }
}